package com.hdaccp.shuiguoD.service.impl;

import com.hdaccp.shuiguoD.dao.ShangpinDao;
import com.hdaccp.shuiguoD.entity.Shangpin;
import com.hdaccp.shuiguoD.service.ShangpinService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ShangpinServiceImpl implements ShangpinService {

    @Autowired
    private ShangpinDao shangpinDao;


    @Override
    public List<Shangpin> getAll() {
        return shangpinDao.queryAll();
    }

    @Override
    public long findTotalCount(String sname) {
        return shangpinDao.getTotalCount(sname);
    }

    @Override
    public List<Shangpin> findAll(String sname, int offset, int limit) {
        return shangpinDao.query(sname,offset,limit);
    }

    @Override
    public Shangpin getsid(int sid) {
        return shangpinDao.geisid(sid);
    }

    @Override
    public int add(Shangpin shangpin) {
        return shangpinDao.add(shangpin);
    }

}
